package 蛇形矩阵;

import java.util.Scanner;

public class Main {
    static int N = 110;
    static int[][] st = new int[N][N];
    static int[] dx = {0, 1, 0, -1};
    static int[] dy = {1, 0, -1, 0};

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        int x = 0, y = 0, op = 0;
        for (int i = 1; i <= n * m; i++) {
            st[x][y] = i;
            int a = x + dx[op];
            int b = y + dy[op];
            if (a < 0 || a >= n || b < 0 || b >= m || st[a][b] != 0) {
                op = (op + 1) % 4;
                a = x + dx[op];
                b = y + dy[op];
            }
            x = a;
            y = b;
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                System.out.print(st[i][j] + " ");
            }
            System.out.println();
        }
    }
}
